/*
 * Copyright (c) 2002 Boris Pruessmann and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Common Public License v0.5
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v05.html
 * 
 * Contributors:
 *    Boris Pruessmann - Initial implementation.
 */
package net.sourceforge.perforce.ui.internal.filters;

import net.sourceforge.perforce.core.resources.RemoteFile;
import net.sourceforge.perforce.core.syncinfo.ResourceSyncInfo;

import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

/**
  * @version $Revision: 42 $
  * @author  <a href="mailto:bpruessmann@users.sourceforge.net">Boris Pruessmann</a>
  */
public class DeletedFilesFilter extends ViewerFilter 
{
	// ------------------------------------------------------------------------------ Public Methods
	
	/** @see org.eclipse.jface.viewers.ViewerFilter#select(Viewer, Object, Object) */
	public boolean select(Viewer viewer, Object parentElement, Object element) 
	{
		if (!(element instanceof RemoteFile))
		{
			return true;
		}
		
		RemoteFile file = (RemoteFile) element;
		ResourceSyncInfo syncInfo = file.getSyncInfo(null);
			
		return !syncInfo.isDeleted();
	}

}
